import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TPetCollectAttr } from "../../../Message/Db/Tables/TPetCollectAttr";
//class PetCollectAttrConfig
    
    export  class PetCollectAttrConfig
    {
        constructor()
        {
            
            if (PetCollectAttrConfig._instance != null) 
            {
                throw new Error(" PetCollectAttrConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._dic = new Map<any, any> /* flash.utils.Dictionary */();
            var loc1=ConfigManager.instance.getJSONByFileName("t_pet_collect_attr.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TPetCollectAttr();
                loc1.modelId = loc2.modelId;
                loc1.attrType = loc2.attrType;
                loc1.addAttr = loc2.addAttr;
                loc1.materialNum = loc2.materialNum;
                this._dic[loc1.modelId] = loc1;
            }
            return;
        }

        public getItemByAvatarId(arg1: string): TPetCollectAttr
        {
            return this._dic[arg1] as TPetCollectAttr;
        }

        public static get instance(): PetCollectAttrConfig
        {
            if (PetCollectAttrConfig._instance == null) 
            {
                PetCollectAttrConfig._instance = new PetCollectAttrConfig();
            }
            return PetCollectAttrConfig._instance;
        }

        /* internal */ /* var */_dic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: PetCollectAttrConfig;
    }
